﻿// ------------------------------------------------------------------------------
//  © 2008 OpenUpon™.  All rights reserved.
// ------------------------------------------------------------------------------
using System.Collections.Generic;
using Castle.ActiveRecord;

namespace CastUpon.Entities {
	[ActiveRecord]
	public class iTunesCategory : ActiveRecordBase<iTunesCategory> {
		private string category;
		private PodcastChannel channel;
		private IList<iTunesCategory> children = new List<iTunesCategory>();
		private int id;
		private iTunesCategory parentCategory;

		[PrimaryKey]
		public int Id {
			get { return this.id; }
			set { this.id = value; }
		}

		[BelongsTo("ParentId", NotNull=false)]
		public iTunesCategory ParentCategory {
			get { return this.parentCategory; }
			set { this.parentCategory = value; }
		}

		[BelongsTo("ChannelId")]
		public PodcastChannel Channel {
			get { return this.channel; }
			set { this.channel = value; }
		}

		[Property]
		public string Category {
			get { return this.category; }
			set { this.category = value; }
		}

		[HasMany(Table = "iTunesCategory", ColumnKey = "ParentId", Inverse = true, Cascade = ManyRelationCascadeEnum.AllDeleteOrphan)]
		public IList<iTunesCategory> Children {
			get { return this.children; }
			set { this.children = value; }
		}
	}
}